<?php
	DEFINE('H1', 'Testing the XML Reading');
	DEFINE('TITLE','Testbed Script');
	require('includes/header.php');
?>	
	<h2><?PHP echo H1 ?></h2>


<?php

	wrt("ABout to create a new XML file for our LIBX XML...");

	$stg = "<?xml version=\"1.0\"?>\n<libx/>\n";

	$xml1 = simplexml_load_string($stg);

	$title = "Moby Dick";
	$bk = $xml1->addChild('book');	//IF NO TEXT FOR THE ELEMENT, ONLY USE THE TAG NAME (NO TEXT AS FOR <pages? BELOW
	$bk->addAttribute('genre', 'Humor');
	$bk->addAttribute('rating', "5");
	$bk->addChild('title', $title);
	$bk->addChild('author', 'Herman Melville');
	$bk->addChild('pages', '734');


wrt("");
wrt("Now using var_dump() to DUMP THE LIBX ARRAY");
var_dump($xml1);
wrt("");
wrt("NOW AS asXML() YOU NEED TO VIEW SOURCE TO SEE IT ON YOUR PAGE");
   echo $xml1->asXML();
	
	$xml1->asXML("misc/libx.xml");
	wrt("");
	wrt("DONE.  Now check misc/libx.xml");
	wrt("");


	wrt("NOW BEGINNING TO BUILD A MENU FROM SCRATCH...");
		$updtXML = "<?xml version=\"1.0\"?><menu/>";
		$sxe = simplexml_load_string($updtXML);
		
		$choice = "Home Page";
		$url = "XXXHome.php";
		$visibility = "inline";
		
		$chc = $sxe->addChild('choice', $choice);
		$chc->addAttribute('url', $url);
		$chc->addAttribute('display', $visibility);
		
		$choice = "Maintain Menu";
		$url = "MaintainMenu.php";
		$visibility = "inline";
		
		$chc = $sxe->addChild('choice', $choice);
		$chc->addAttribute('url', $url);
		$chc->addAttribute('display', $visibility);

		$choice = "Testbed Script";
		$url = "Testbed.php";
		$visibility = "none";
		
		$chc = $sxe->addChild('choice', $choice);
		$chc->addAttribute('url', $url);
		$chc->addAttribute('display', $visibility);



		$sxe->asXML('misc/newMenu.xml');
	wrt("DONE.  Now check misc/newMenu.xml");


?>

<?php
	require('includes/footer.php');
?>
)